ruby:
  demo_mode = default_admin_in_demo_mode?(user)
  update_url = demo_mode ? root_path : (user.new_record? ? admin_users_path : admin_user_path(user))

= simple_form_for(user, url: update_url, data: { action: 'turbo:submit-end->modal#close' }) do |f|
  .card-body
    = f.error_notification

    = f.input :username, required: true
    = f.input :email, required: true
    = f.input :password

    = f.input :locale, as: :select, collection: User.options_roles, label_method: :last, value_method: :first, include_blank: false
    = f.input :appearance, as: :select, collection: User.options_appearances, label_method: :last, value_method: :first, include_blank: false
    = f.input :timezone, as: :select, collection: User.options_timezones, label_method: :last, value_method: :first, include_blank: false
    = f.input :role, collection: user_roles, include_blank: false

  .card-footer
    - if demo_mode
      = f.button :button, t('errors.messages.invaild_in_demo_mode'), disabled: true
    - else
      = f.button :submit
